<template name="zPictureCreate">
	<view class="center-view">
		<view class="option-item">
			<text class="item-name">问题</text>
			<input class="item-content theme-input" style="width:70%" v-model="que"/>
		</view>
		<!-- <view>
			<text>图片大小限制(单位M):</text><input type="number" v-model="maxSize" style="background-color:blue;"/>
		</view> -->
		<view class="option-item">
			<text class="item-name">是否可空:</text><switch class="item-content" color="green" :checked="empty" @change="changeEmpty" style="margin-top:-10upx" />
		</view>
	</view>
</template>
<script>
	export default {
		name : "zPictureCreate",
		data() {
			return {
				que : "",
				maxSize : 1,
				empty : false
			};
		},
		props : {
		},
		created : function(e){
			
		},
		methods: {
			get : function(id){
				if(this.que == ''){
					uni.showModal({
						title : '错误',
						content : '问题不可为空',
						showCancel : false
					})
					return null;
				}
				// if(this.maxSize <= 0 || this.maxSize >32){
				// 	uni.showModal({
				// 		title : '错误',
				// 		content : '文件大小应为一个1~32之间的数',
				// 		showCancel : false
				// 	})
				// 	return null;
				// }
				var res = {}
				res['question'] = this.que;
				res['key'] = 'q' + id;
				res['type'] = 'zpicture';
				var answer = {};
				answer['maxSize'] = this.maxSize;
				answer['empty'] = this.empty;
				res['answer'] = answer;
				this.que = '';
				this.maxSize = 32;
				this.empty = false;
				return res;
			},
			changeEmpty : function(e){
				this.empty = e.detail.value;
			}
		}
	}
</script>

<style>
	@import "../../../common/zcss.css";
	@import "./creator.css";
</style>
